<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Abstractadmin extends CI_Controller
{
    public function __construct() {
        parent::__construct();
        session_start();
        $this->load->model("usermodel");
    }
    //返回
    public static function json($data) {
        if(is_array($data)) {
            return exit(json_encode($data));
        }
    }
    //判断是否登陆
    public function isAdmin() {
        if (!isset($_SESSION['user'])) {
            header("location:/login/index");
        }
    }
    public  function  getUser(){

        if(isset($_SESSION)&&array_key_exists('user',$_SESSION))
        {
            $user=$_SESSION['user'];
            return $user;
        }
        return null;
    }

}